package com.hca.training.zk.javabasic.Box;

import java.awt.*;

public class Box<T> {
    private T tClass;

    public Box(Object i) {
        this.tClass= (T) i;
    }

    public T gettClass() {
        return tClass;
    }
    public static void getData(Box<? extends Number> box) {
        System.out.println("number data: " + box.gettClass());
    }
    public void settClass(T tClass) {
        this.tClass = tClass;
//        Type type=tClass.getClass().getSuperclass();
//        if (ParameterizedType.class.isAssignableFrom(type.getClass())) {
//            for (Type t1 : ((ParameterizedType) type).getActualTypeArguments()) {
//                System.out.print(t1.getTypeName());
//            }
//
//    }
 System.out.println(tClass.getClass().getName());
    }
//    public static void main(String[] args) {
//        Box<Date> a = new Box<>();
//        Date b= new Date();
//        a.settClass(b);
//    }
    public static void main(String[] args) {


        Box<Integer> b1 = new Box(30);
        Box<Number> b2 = new Box(45d);
        Box<Float> b3 = new Box(60f);
        getData(b1);
        getData(b3);
        getData(b2);
    }



}

